/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.appspot.trafficando.infrastructure.provider;

import com.appspot.trafficando.domain.UrlConnection;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

/**
 *
 * @author Domenico Maria Giffone
 */
public class HttpUrlConnection implements UrlConnection {

    @Override
     public InputStream getRemoteStream(String address, int timeout) throws IOException {
        URL u = new URL(address);
        HttpURLConnection con = (HttpURLConnection) u.openConnection();
        con.setConnectTimeout(timeout);
        return con.getInputStream();
    }

}
